package com.ruoyi.im.utils;


/**
 * 字符工具
 * 2021-3-17
 * by GuangHeLiZi
 * 更多请鉴
 * */
public class StringUtils {


    static AllToByte allToByte=new AllToByte();
    static ByteToAll byteToAll=new ByteToAll();
    static ByteUtils byteUtils=new ByteUtils();
    static MD5Helper md5Helper=new MD5Helper();
    static HexUtils hexUtils=new HexUtils();
    static RandomUtils randomUtils=new RandomUtils();


   static byte[] dd=new byte[]{0, 0, 8, -112, 0, 0, 0, 10, 2, 0, 0, 0, 0, 14, 50, 53, 54, 53, 53, 55, 56, 54, 49, 53, -14, -28, 91, 51, -62, 112, 35, 116, 121, 68, 61, -58, -18, -105, -128, 105, 0, -102, -2, -4, 42, 19, -11, 123, -19, 110, 44, 76, -99, 121, -111, -94, 55, -2, 105, -70, -61, -121, -77, 81, -92, -64, 77, -117, -121, 23, 26, 15, -63, 117, -68, 72, -31, -111, 37, 92, -77, -119, 2, 75, -112, -102, -114, -69, 102, -119, -54, -98, -56, 86, -56, -12, -26, 10, -128, -48, -85, -92, 39, 60, 78, -51, -20, 30, -1, 2, -11, 78, 51, -23, 23, 15, 121, -115, 0, 64, 71, 113, -33, -61, -107, -89, 76, -3, 100, -61, 15, -35, 36, 89, 107, 44, 15, 27, 80, -82, -37, -90, 16, 83, 81, -46, -19, -44, 17, 119, 89, 72, -60, -40, -106, 21, 120, -126, -83, -68, 48, -24, -92, -89, -87, -122, 24, -16, 103, -83, 59, -124, 26, -43, -75, 105, -37, 59, 21, 0, 29, -128, -54, -84, -98, -17, -12, -60, -20, -39, 12, -2, -40, 81, 32, -102, 12, -96, 82, -37, -93, 44, 89, -33, -125, -79, -72, -108, -126, 0, -78, 59, -108, -84, 17, 98, -47, 6, -66, -118, -5, -74, 23, 85, -56, -44, 105, 59, 28, -29, 56, 17, 92, 107, 73, 81, 55, 115, -98, 48, -96, 35, 33, 3, -9, -28, -13, 127, -62, -92, 17, 83, -84, -20, -26, -20, 86, -23, 74, -77, 58, -88, 9, -9, -75, -27, -4, 34, -28, -84, 60, -37, -11, -63, -85, -128, 49, -21, 68, -26, 77, -8, -91, -113, 5, 5, 28, -112, -10, -75, -94, -39, -10, 42, 50, 45, -109, 18, -58, -94, 26, 119, -27, 65, -74, 27, -116, -128, -99, -58, 4, 56, -49, 84, 33, -18, 66, -8, 18, 18, -68, -28, -42, -41, -36, -10, 20, 106, -54, 116, 41, -40, -26, 33, 82, 38, 97, -124, 96, 39, -116, -80, 0, 102, 78, -97, 38, -23, -114, -115, 54, -86, 14, -38, -33, 55, 4, -44, -127, -7, -70, -114, -126, 95, -121, -92, 44, -82, -75, 15, 45, -49, -55, 11, -66, -30, -125, 90, -124, -70, 113, 109, 57, -122, -24, 29, -51, 46, 11, 127, 28, 99, 1, -80, -111, 13, -17, -46, 36, 90, -11, -6, 83, 12, 118, -122, -83, -98, -38, 87, -104, 118, 49, 0, 24, -5, -9, -38, 22, 39, 25, -83, -99, 44, -62, 91, 32, 121, 88, -68, -107, -126, 72, -45, 65, -4, -80, 25, -25, 88, -61, -75, 36, 120, 35, 8, 94, 28, -33, 10, -84, -95, -111, -15, 60, 80, -19, -31, -87, -49, 45, -28, -30, -10, -69, 86, 22, -65, -37, -59, -122, 126, 112, 57, -99, -52, 73, 124, -53, -14, -87, 50, -127, -34, 107, 115, 54, -121, -13, -23, 31, -87, 28, 101, 95, -98, -127, -2, -32, 88, 66, 60, 32, -97, 78, 47, -5, 59, -55, -72, 43, -87, -40, 30, 83, -80, -40, -49, 89, -44, -27, -76, 78, 98, -13, 71, -102, 65, -12, 26, -95, -115, 40, 51, -42, 59, 76, -32, -19, -56, -30, 49, -49, -77, 33, 75, -98, -89, 6, -40, 68, -4, -81, -116, 8, 115, 2, -58, 19, 1, 39, 104, 20, -59, 18, -100, 92, -97, 121, 62, 35, -8, 17, -30, 105, -13, 14, 4, 19, 33, 81, -118, 68, -41, 124, 0, 98, -73, 92, 82, 39, 116, -55, -44, 89, -96, 42, -10, 8, 113, 36, -81, -53, 24, 28, -95, 126, -96, 121, -44, 80, 87, 36, -91, -62, 18, -88, -56, 124, 8, -103, 89, -27, 74, -95, -83, -42, -49, -83, 68, 54, -92, -71, 23, 17, 8, 65, -14, -8, 62, -4, 66, -70, 120, 78, 112, 6, -70, -10, 38, 62, 81, 95, -27, 15, -48, 40, 1, 21, 92, -72, 57, 60, 90, -64, 14, 76, 79, -6, -26, 111, -42, -12, -29, 45, -59, -8, -65, 16, 98, 87, -121, -1, -71, 70, -91, 96, 91, 40, -47, 31, -105, 20, -117, 0, 9, -118, 115, -97, -127, -4, 83, 108, -76, -1, 78, -1, 53, -25, -4, -43, -7, -71, 41, 30, -40, -115, -95, -51, 76, 45, 5, 3, -8, -8, 56, -102, 19, -60, -59, 46, 30, 87, 38, -48, -112, -57, 49, -50, 43, 95, 46, -25, -113, 4, 29, -59, -83, 68, 96, 59, 4, 120, -69, -118, 87, 42, -36, -122, 6, -99, 92, 28, -121, 96, 76, 60, -78, 70, -6, 86, -81, -95, -51, -34, -120, 115, -65, 14, -53, 108, -114, -72, 1, -101, -105, -94, 86, 88, 2, 110, -78, 43, 44, -94, -55, 4, 23, -85, -124, -14, -5, 22, 49, 91, 14, 124, 46, -61, -57, -45, 41, -2, 73, 5, 113, -82, 22, 9, -103, -86, 81, -25, 38, -123, -116, -98, 34, 21, 89, -78, 20, 89, 18, -1, -101, -14, 98, -5, 6, -117, 101, -24, -6, 50, -109, -80, -7, -115, -107, 50, 17, -117, 125, -124, -63, 10, 46, 98, 1, 32, -104, 109, -43, 14, 45, -45, 52, 114, 60, -102, 69, 47, 79, 54, -63, -8, -18, 88, -105, 40, 18, 3, -122, 93, -29, 88, 27, -22, 84, -112, 26, -12, -2, 95, 77, 44, 4, 47, -30, 26, -28, 111, -112, -34, -16, 71, -9, -65, 61, -14, 49, -17, -29, 23, -52, -82, 17, 68, 10, -37, -36, 79, 58, -16, 41, 72, -106, 1, -9, 111, 93, 58, 69, 44, 42, -2, 115, 70, 102, 39, -62, -1, -35, 42, 100, -115, -125, 25, -103, -103, 56, 122, -14, -4, -47, -33, -32, 44, 90, -102, -40, -20, -100, 124, -31, 44, -99, -33, 120, 58, -71, 100, -75, 77, 14, 34, -64, -54, -7, 32, -41, 100, 126, -91, 97, 91, -100, 42, 40, -7, 127, 49, -6, 52, -47, 3, 25, 73, 43, -97, -38, -127, -79, -33, -123, 70, -79, -98, 90, 75, 57, -77, 44, 71, -40, 99, -117, -8, 92, 85, 20, -81, -39, -68, -58, -106, 9, -92, 126, 46, -100, -114, -114, 75, 77, 1, 103, -69, 65, -117, -27, 81, -48, -107, -108, -77, -108, -72, 31, -52, 51, 113, -73, -60, 85, 51, -36, 87, 14, -72, -5, 79, -71, -25, 19, -16, -58, -18, -50, 68, -101, -73, 29, 30, -59, 28, -12, -35, 7, -26, 79, -67, -64, -102, -120, 72, 45, 58, -55, 93, 0, -37, -64, -121, -2, 124, 67, 86, -25, 37, -63, 23, 35, -40, 101, 88, -105, 15, 111, 16, 91, -68, 67, 44, -81, 7, 112, 112, -51, 52, 23, -15, -93, -53, 16, -122, 41, 72, 82, 36, 10, -79, -13, -34, -79, 6, -118, 108, 103, 22, -7, 6, -66, 62, 8, -21, -118, 25, -118, -126, -11, 113, -117, -99, 94, -71, -34, -29, 101, 85, -77, 49, -67, -58, 90, -123, 8, 30, -95, -64, 87, 33, 73, 5, 118, 48, -83, 1, 87, -121, 56, -126, 41, 120, -17, -59, -27, -3, -116, -64, -110, 1, -13, 53, -126, -33, -12, 80, 42, -11, -118, -121, 56, -122, 116, -8, 77, 19, 69, 55, 87, -12, 88, -126, -13, 34, 37, 46, 30, -26, 96, 71, 80, -7, -109, -96, 113, 90, 12, 57, -128, -55, -85, -90, 95, -115, 112, -1, 71, -15, -98, 101, 97, -75, 24, 27, -105, -75, -12, -72, -44, -83, -3, -127, 60, -94, -81, 91, 33, 60, -89, -76, -57, 48, 81, 112, 47, 68, -59, 90, 110, 107, -15, -5, -64, 6, 93, -40, -12, 118, 66, 67, -62, -50, 116, 123, -20, -31, 120, -85, 24, -62, 29, 102, 50, 63, 90, -15, 123, 43, -109, 78, -75, -20, -105, -62, -46, -54, 77, 76, -56, -92, 126, -82, 5, -127, -24, 59, -113, 66, 94, 44, -118, 60, -47, -115, -36, -19, -110, -63, -69, 102, -13, -127, 104, 78, -57, 107, -5, 21, -94, -27, -67, -116, -89, -31, 100, 15, 23, 125, 67, 122, 58, 53, -96, 2, -7, 41, 109, -65, 3, 92, 109, -3, 24, 70, -52, 100, -79, -92, -72, -32, 63, 20, 71, 114, -33, 52, -13, 33, 75, -17, 117, 83, 100, 62, -7, -92, 51, 10, 61, 38, -47, 46, 40, 79, 49, 5, -12, -50, -102, 113, 105, 15, 2, 127, 68, -26, 21, 126, 60, -128, -36, 104, 85, 6, 25, -95, 3, 109, -13, -72, -26, 6, 42, 127, 97, -80, 3, 31, 91, 62, -116, 99, -37, -50, 36, 21, 13, 58, -35, 124, 17, -82, -83, 79, 31, -102, 119, -84, 126, 48, -113, 18, 67, -109, -6, 107, 27, 121, 37, 116, -100, 12, 22, 75, 117, 25, 22, 89, -58, 113, 120, 122, -25, 125, -61, 10, 100, -1, -36, 26, -87, 1, 70, -108, -2, 111, 56, -9, -84, 35, -59, -71, -16, -57, -50, 60, -100, -93, -60, 97, 86, 0, 88, 94, 27, -105, 82, -61, -31, -65, 5, -96, 23, -124, 32, 25, -75, -101, 88, 109, -81, 88, 55, 19, 75, 97, 21, 106, -13, -70, -47, -69, 87, -63, -10, 78, -56, -122, -42, -69, 77, 56, 64, 5, 100, 107, -26, 115, 54, 54, -92, -63, 78, -100, 28, 25, -21, 64, 14, 34, 18, 89, 37, -29, 57, -37, 4, 61, -119, -19, 106, 114, 120, -74, 38, 29, 20, 88, 28, 67, -86, -97, 85, -81, -57, 100, 31, 113, -119, 39, -25, 92, -93, 27, -6, -45, 32, -11, 100, 31, 39, 78, 85, -57, 27, -83, -119, 109, -59, 25, -118, -108, -58, 61, 53, -24, 58, 74, 77, 75, -70, 12, 106, -11, 64, -101, -67, 35, 74, 97, -83, 3, -55, -125, 88, 13, -110, -89, 120, 126, -26, 100, -88, 4, 63, -48, -36, 58, -64, 119, -76, 51, -34, 18, 46, -100, 14, 15, 7, 108, -8, 1, 109, 120, -82, 1, -65, -107, -106, 50, -30, -109, 113, -38, 93, 4, -21, -117, 4, -12, 15, 17, -4, -10, 18, -86, -23, -41, -1, 69, -55, -116, 90, -110, -4, 56, 66, -121, 104, -7, 5, -55, -64, 68, 61, -85, -41, 114, 32, -40, -114, -9, -31, 93, 119, -40, -34, 103, 58, 65, 16, 35, -107, 91, 115, 72, 27, 117, -106, 39, -45, 11, 17, -11, -90, 24, 3, 48, -25, -106, 10, -107, -35, 23, 119, -15, -72, -97, 119, -39, 36, -9, 126, 46, 94, 125, 119, 45, -39, 13, -73, -76, 88, 114, 55, -103, 32, -114, 14, 31, -103, -26, -11, 88, 43, 54, -76, -60, 81, 28, 58, -55, -68, 20, 9, -118, -85, -7, 68, -108, 38, 23, -52, -49, -69, -108, -63, 33, -93, -114, 52, -127, -18, -100, 123, 104, 97, 16, 92, 89, -44, -65, 109, -37, 111, 119, -70, -94, -79, 31, -22, 16, 87, -93, -111, -1, -19, 72, 83, -70, -11, -69, -37, -100, -31, -100, 52, 80, -80, 69, 103, 12, -91, 75, -91, 8, -24, 14, 84, 123, -27, -1, -121, 104, 95, -10, -10, -73, -55, -66, 71, -38, -44, -7, -50, 44, -27, 3, 114, 79, -64, -110, 126, 90, 13, 65, 72, 2, -6, 103, -44, 31, 26, -72, 23, 48, 82, 81, -4, -89, -106, -18, -120, 80, -55, -36, 92, 64, -65, -26, -70, 82, 58, 29, 95, -69, 114, -77, 22, 22, -112, 97, -77, 36, -80, -62, -59, -60, -22, -77, 93, 46, 14, -93, -107, 110, -37, -105, -82, 103, 54, -100, 100, 98, -81, -45, -25, -117, -84, -92, -103, -123, -72, -121, -38, -101, 25, 124, 8, 42, -112, -28, -12, 61, 74, 39, -88, 42, 34, 84, 8, 56, 27, -63, -126, -12, -77, 52, 52, 73, 123, 76, -52, -125, 57, 120, -56, -103, -54, -19, 94, -98, -61, 80, -8, -87, -37, 84, -2, 58, -33, 9, 61, -112, 93, -42, 21, -11, 90, -54, 108, -120, 46, 12, 100, -94, 75, -58, -123, -71, -69, -64, 33, 98, -50, -53, -15, -83, 108, -3, 93, -109, 84, 114, -7, 109, 115, 53, -91, -66, -118, -10, 69, 118, -7, -72, 47, 107, -99, 34, 93, -85, 50, -20, 123, -107, -16, 39, 81, -29, -39, 121, -12, -22, 73, 91, -120, 95, -32, -38, 83, -113, -67, 34, -84, -82, -16, 66, -50, 30, 109, -109, -35, 93, 52, 38, 46, 91, 102, 76, 61, 105, 101, 105, -59, 104, 16, 98, -32, 13, -17, -34, -70, 32, 2, -49, -116, -67, -62, -119, 81, -65, -74, 67, -68, 19, 95, -17, 95, -29, 126, -107, -82, -3, -30, -92, -127, 108, 114, 2, 61, -112, 65, 24, -124, -3, -48, 77, -84, -34, -84, -89, -66, -17, 62, -114, 108, 108, 83, -37, -117, -112, 82, -89, 101, -72, 75, -57, -108, -8, 54, -123, -4, -19, -90, -45, -33, -114, 98, 20, -87, -27, -125, -19, -127, -105, -48, 121, -57, 83, -20, -47, 32, 106, -112, -124, -22, 53, -1, 115, 91, 39, 83, -86, -5, 4, 86, 124, 2};
     static byte[] in=new byte[]{50, 53, 54, 53, 53, 55, 56, 54, 49, 53};


    /**
     * @param bin
     * @param sub
     * @return 第一次tea解密
     */
    public  byte[] indexOf(byte[] bin, byte[] sub){
        if(bin == null||sub==null){
            return null;
        }
        String sbin=byteToAll.byteToHxe(bin);
        String sSub=byteToAll.byteToHxe(sub);
        if (bin.length==allToByte.hexToByte(sbin.substring(sbin.indexOf(sSub) + byteToAll.byteToHxe(sub).length())).length){
            return null;
        }else {
            return allToByte.hexToByte(sbin.substring(sbin.indexOf(sSub) + byteToAll.byteToHxe(sub).length()));
        }

    }




}
